package cn.tedu.seckill.controller

import org.springframework.amqp.rabbit.core.RabbitTemplate
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController
import cn.tedu.staticResources.ComRe

@RestController
class SendController {
  //测试发送代码
  @Autowired
  private val sender: RabbitTemplate = null
  //请求seckill系统,传递一个参数 msg
  @RequestMapping(Array("send"))
  def send(msg: String) = {
    //第一次调用代码发送数据之前,会根据
    //声明的各种对象创建消息队列的组件
    sender.convertAndSend("seckillEX", "seckill", msg)
    ComRe.success
  }
}





